/*
*	(*^。^*) TFrameWork License (*^。^*)
*/

/*
 *  Title :  
 *          
 *  Description :  
 *          
 *          
 *  Date : 
 *
 *  Author : DengPing
 *
 *  Modify : 
 */
using UnityEngine;

namespace TFrameWork.Module.ActionEditor
{
    [System.Serializable,TrackDataKey(nameof(AnimationEvent))]
    public class AnimationEvent : TrackEventBase
    {
        public AnimationClip animationClip;
        public bool applyRootMotion = true;

        public ExceedType exceedType = ExceedType.None;
        
        /// <summary>
        /// 过渡时间
        /// </summary>
        public float TransitionTime = 0.25f;
        
        public enum ExceedType
        {
            None,
            Hold,
            Loop,
            PingPong,
            Continue,
        }

        public void SetClip(AnimationClip clip)
        {
            animationClip = clip;
            durationIndex = (int)(clip.length * clip.frameRate);
        }

        public override object Clone()
        {
            var clone = base.Clone() as AnimationEvent;
            clone.animationClip = animationClip;
            clone.durationIndex = durationIndex;
            clone.exceedType = exceedType;
            clone.TransitionTime = TransitionTime;
            return clone;
        }
    }
}
